﻿#Requires AutoHotkey v2.0

if (WinExist("ahk_exe 猪猪快递云.exe")) {
    WinActivate("ahk_exe 猪猪快递云.exe")
    WinWait("ahk_exe 猪猪快递云.exe",,5)
}
else {
    Run("猪猪快递云.exe")
    WinWait("ahk_exe 猪猪快递云.exe",,5)
}


if (WinExist("登陆猪猪快递云")){

    ; 填入用户名 密码
    ; loginName := IniRead("login.ini", "lg", "name" , "")
    ; loginPwd :=IniRead("login.ini", "lg", "pwd" , "")
    
    ; if (loginName =="") {
    ;     MsgBox("请设置猪猪快递云的账号密码")
    ;     return
    ; }

    ; ControlGetText()
    ; ControlFocus("")
    ; Send(loginName)

    ; MsgBox("需要登录")
    Send("!l")
}


if (WinExist("ahk_exe 猪猪快递云.exe")) {

    WinWait("猪猪快递云",,5 )
    
    Send("!N")
    Send("E")
    Send("!E")

    ; 现在到了文件打开窗口
    excelFile:=A_WorkingDir . "\express.xlsx"
    
    tempClip := A_Clipboard
    A_Clipboard := excelFile

    Send("^v")
    Sleep(100)


    Send("{enter}")


    ; WinWaitClose("ahk_exe 猪猪快递云.exe","打开")
    Send("!J")

    ; 发布
    Send("!F")

}
else {
    MsgBox("2222")
}